package com.snail.model.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @author cici
 * @description 用户搜索
 * @date 2025/8/19 16:12
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(indexName = "sys_user")
public class User {
    @Id
    @Field(name = "email", type = FieldType.Keyword) // 用 email 作为 document_id
    @JsonProperty("email")
    private String email;

    @Field(name = "username", type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("username")
    private String username;

    @Field(name = "nickname", type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    @JsonProperty("nickname")
    private String nickname;

    @Field(name = "phone", type = FieldType.Keyword)
    @JsonProperty("phone")
    private String phone;

    @Field(name = "file_path", type = FieldType.Keyword)
    @JsonProperty("file_path")
    private String filePath;

    @Field(name = "dept_name", type = FieldType.Keyword)
    @JsonProperty("dept_name")
    private String deptName;

    @Field(name = "address", type = FieldType.Keyword)
    @JsonProperty("address")
    private String address;

    @Field(name = "business_img", type = FieldType.Keyword)
    @JsonProperty("business_img")
    private String businessImg;

    @Field(name = "deleted", type = FieldType.Integer)
    @JsonProperty("deleted")
    private Integer deleted;

    @Field(name = "update_time", type = FieldType.Date)
    @JsonProperty("update_time")
    private Date updateTime;

    @Field(name = "type", type = FieldType.Keyword)
    @JsonProperty("type")
    private String type;
}
